/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package eu.ict_omelette.mashup.canonicalmodel.test;
import eu.ict_omelette.mashup.adapters.pipes.Canonical2Json;
import eu.ict_omelette.mashup.adapters.pipes.KindOfFile;
import eu.ict_omelette.mashup.adapters.pipes.PipesAdapter;
import eu.ict_omelette.mashup.canonicalmodel.CanonicalMashup;
import eu.ict_omelette.mashup.canonicalmodel.Component;
import java.io.File;
import java.net.URI;
import java.util.Iterator;
/**
 *
 * @author guybrush
 */
public class JustDebug {

    static final String Pipes_Path = "/tmp/pipes/json",
                        Seri_Path = "/tmp/pipes/ser";

    public static void main(String args[]){
        try{
            String dirPath = Seri_Path;
            String[] children = new File(dirPath).list();

            if(children == null || children.length < 1)
            { System.out.println("Directory does not exists or it is empty"); System.exit(1); }

            for(int i = 0; i < children.length; i++)
            {
                String filename = children[i], filepath = "";
                if(filename.contains("pipe") || filename.contains(".ser")) filepath = dirPath + "/" + filename; else break;

                KindOfFile kof = KindOfFile.serialized;
                if (dirPath.equals(Pipes_Path)) { kof = KindOfFile.json; }

                CanonicalMashup cm = new Canonical2Json(kof, filepath).getCanonicalMashup();

                for (Iterator<Component> it = cm.getComponents(); it.hasNext();)
                {
                    Component c = it.next();
                    Canonical2Json.converteInputParameters(c.getType(), c.getInputParameters(), c.getEmbeddedComponents());
                }

            }
        }catch(Exception e){
            e.printStackTrace();
        }
    }
}
